import 'package:flutter/material.dart';

import 'package:top_foundation/top_foundation.dart';
import 'package:top_foundation/utils/util.dart';
import 'package:whale/helper/utils/util.dart';

class TabbarConfig {
  factory TabbarConfig.defalut() => TabbarConfig();

  factory TabbarConfig.line({
    double? tabBarHeight,
    Color? backgroundColor,
    EdgeInsets padding = EdgeInsets.zero,
    double? selectedFontSize,
    double? unSelectedFontSize,
    Color selectedTextColor = Colors.blueAccent,
    Color unSelectedTextColor = const Color(0xff999999),
    String? indicatorImg,
    Alignment indicatorAlign = Alignment.bottomCenter,
  }) =>
      TabbarConfig(
        tabBarHeight: tabBarHeight,
        backgroundColor: backgroundColor,
        padding: padding,
        selectedFontSize: selectedFontSize,
        unSelectedFontSize: unSelectedFontSize,
        selectedTextColor: selectedTextColor,
        unSelectedTextColor: unSelectedTextColor,
        indicator: indicatorImg == null
            ? null
            : BoxDecoration(
                image: DecorationImage(
                  image: AssetImage(indicatorImg),
                  fit: BoxFit.contain,
                  alignment: indicatorAlign,
                ),
              ),
      );

  factory TabbarConfig.bg({
    double? tabBarHeight,
    Color? backgroundColor,
    EdgeInsets padding = EdgeInsets.zero,
    double? selectedFontSize,
    double? unSelectedFontSize,
    Color selectedTextColor = Colors.blueAccent,
    Color unSelectedTextColor = const Color(0xff999999),
    Color? indicatorColor,
  }) =>
      TabbarConfig(
        tabBarHeight: tabBarHeight,
        backgroundColor: backgroundColor,
        padding: padding,
        selectedFontSize: selectedFontSize,
        unSelectedFontSize: unSelectedFontSize,
        selectedTextColor: selectedTextColor,
        unSelectedTextColor: unSelectedTextColor,
        indicator: BoxDecoration(
          color: indicatorColor ?? selectedTextColor.withAlpha(30),
        ),
        indicatorSize: TabBarIndicatorSize.tab,
      );

  TabbarConfig({
    double? tabBarHeight,
    this.backgroundColor,
    this.padding = EdgeInsets.zero,
    double? selectedFontSize,
    double? unSelectedFontSize,
    this.selectedTextColor = Colors.blueAccent,
    this.unSelectedTextColor = const Color(0xff999999),
    this.labelPadding = EdgeInsets.zero,
    this.indicatorColor = Colors.blueAccent,
    this.indicatorWeight = 2,
    this.indicatorPadding = EdgeInsets.zero,
    this.indicator,
    this.indicatorSize,
    this.dividerColor,
    this.dividerHeight = 0,
    this.evaluate = false,
  })  : tabBarHeight = tabBarHeight ?? 50.r,
        selectedFontSize = 17.sp,
        unSelectedFontSize = 15.sp;

  double tabBarHeight;
  Color? backgroundColor;
  double indicatorWeight;
  Color selectedTextColor;
  Color unSelectedTextColor;
  double selectedFontSize;
  double unSelectedFontSize;
  EdgeInsets padding;
  Color? indicatorColor;
  EdgeInsets indicatorPadding;
  Decoration? indicator;
  TabBarIndicatorSize? indicatorSize;
  Color? dividerColor;
  double dividerHeight;
  EdgeInsets labelPadding;
  bool evaluate;
}
